{% extends "base.html" %}

{% block title %}学生列表{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h2>学生列表</h2>
    <a href="{{ url_for('add_student') }}" class="btn btn-primary">添加学生</a>
</div>

<div class="table-responsive">
    <table class="table table-striped">
        <thead>
            <tr>
                <th>编号</th>
                <th>姓名</th>
                <th>性别</th>
                <th>出生日期</th>
                <th>家长姓名</th>
                <th>联系电话</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for student in students %}
            <tr>
                <td>{{ student.id }}</td>
                <td>{{ student.name }}</td>
                <td>{{ student.gender }}</td>
                <td>{{ student.birth_date }}</td>
                <td>{{ student.parent_name }}</td>
                <td>{{ student.phone }}</td>
                <td>
                    <a href="{{ url_for('view_student', id=student.id) }}" class="btn btn-sm btn-info">查看</a>
                    <a href="{{ url_for('edit_student', id=student.id) }}" class="btn btn-sm btn-warning">编辑</a>
                    <form action="{{ url_for('delete_student', id=student.id) }}" method="POST" class="d-inline">
                        <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('确定要删除这个学生吗？')">删除</button>
                    </form>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %} 